package cn.buddha.jesdp.proxystatic;

import lombok.extern.slf4j.Slf4j;

/**
 * @author shihao
 * @description 抽象静态代理类
 */
@Slf4j
public class LoadStaticProxy<T, E> implements LoadInterface<T, E> {

    /**
     * 抽象主题
     */
    protected LoadInterface subjectInterface;

    /**
     * 设置 抽象主题的具体实现类
     */
    public void setSubjectInterface(LoadInterface subjectInterface) {
        this.subjectInterface = subjectInterface;
    }

    @Override
    public E loadData(T t) {
        // 访问真实主题之前的增强
        preLoadData();

        // 具体业务逻辑实现
        return (E) this.subjectInterface.loadData(t);
    }

    public void preLoadData() {
        log.info("公共加载");
    }

}
